package bosc.cn.constant;

/**
 * @author chengcheng
 * @date 2025/9/8 21:02
 * @description 业务错误码
 */
public enum PrcStsEnum {

    SUCCESS("PR00", "成功"),
    FAIL("PR01", "处理中"),
    PARAM_ERROR("PR02", "参数校验失败"),
    VERIFY_ERROR("PR03", "签名验证错误"),
    OTHER_ERROR("PR99", "其他错误"),
    ;

    private final String code;
    private final String msg;
    PrcStsEnum(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }
    public String getCode() {
        return code;
    }
    public String getMsg() {
        return msg;
    }
    public static String getMsgByCode(String code) {
        for (PrcStsEnum value : PrcStsEnum.values()) {
            if (value.code.equals(code)) {
                return value.msg;
            }
        }
        return null;
    }
    public static String getCodeByMsg(String msg) {
        for (PrcStsEnum value : PrcStsEnum.values()) {
            if (value.msg.equals(msg)) {
                return value.code;
            }
        }
        return null;
    }
    public static PrcStsEnum getByCode(String code) {
        for (PrcStsEnum value : PrcStsEnum.values()) {
            if (value.code.equals(code)) {
                return value;
            }
        }
        return null;
    }

}
